<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html">
    <body>
        <ui:composition template="../templates/default3.xhtml">        
            <ui:define name="content">
                <h:form id="searchConsolidatedMthSalesFc" binding="#{salesForecastManagerBean.loadSearchConsolidatedMthSalesFc}">
                 <p:messages id="error"/>
                    <p:panel header="Select Sales Forecast" id="selectSalesForecast">


                        <p:dataTable id="consolidatedMthSalesFc" var="consolidatedMthSalesFc" value="#{salesForecastManagerBean.consolidatedMthSalesFcs}" selectionMode="single" selection="#{salesForecastManagerBean.consolidatedMthSalesFc}" update ="consolidatedMthSalesFc" paginator="true" rows="12"  
                                     paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}" >

                            <p:column  headerText="Month" >  
                                <center><h:outputText value="#{consolidatedMthSalesFc.salesMonth}" /> </center> 
                            </p:column> 

                            <p:column  headerText="Year" >  
                                <center>  <h:outputText value="#{consolidatedMthSalesFc.salesYear}" />  </center>
                            </p:column> 
                            
                             <p:column headerText="Forecast completed" >  
                                <center> #{consolidatedMthSalesFc.completed}   </center>
                            </p:column> 
                            
                              <p:column headerText="Status" >  
                                <center> #{consolidatedMthSalesFc.status}   </center>
                            </p:column> 

                        </p:dataTable>



                    </p:panel>

                    <table class="table-submit">
                        <tr>
                            <td align="center">
                            
                                <p:commandButton value="Submit Sales forecast" actionListener="#{salesForecastManagerBean.submitConsolidatedMthSalesFc}" rendered="#{salesForecastManagerBean.canSubmit}" ajax="true" update="error"/>
                                <p:commandButton value="Add Production schedule" actionListener="#{salesForecastManagerBean.processConsolidatedMthSalesFc}" rendered="#{salesForecastManagerBean.isProcess}" ajax="true" update="error"/>
                                <p:commandButton value="Finalize Production schedule" actionListener="#{salesForecastManagerBean.fianlizeConsolidatedMthSalesFc}" rendered="#{salesForecastManagerBean.isFinalize}" ajax="true" update="error"/>
                            </td>
                        </tr>
                    </table>
                 
                 


                </h:form>
            </ui:define>        
        </ui:composition>
    </body>
</html>
